<template>
  <div>
    <input type="text" v-model="name.a">
    <button @click="seve">修改</button>
  </div>
</template>

<script>
import { reactive, ref, toRefs } from "vue";
export default {
  name: "",
  // 定义模板
  components: {},
  //在创建组件之前执行
  setup(props, context) {
    const state = reactive({
      name: {
        a:'nihao'
      },
    });
    const num = ref(0);

    const seve=() => {
      console.log(state.name.a)
    }

    return {
      ...toRefs(state),
      num,
      seve
    };
  },
};
</script>
<style scoped lang ='less'>
</style>